/**
 * Created by MorenYang on 2017/11/11.
 */
import axios from 'axios';

const DEV_BASE_URL = 'http://localhost:8080/';
const DEPLOY_BASE_URL = '';
export const r = axios.create();

if (process.env.NODE_ENV === 'development') {
  r.defaults.baseURL = DEV_BASE_URL;
} else {
  r.defaults.baseURL = DEPLOY_BASE_URL;
}

const post = (url, payload) => {
  return r.post(url, payload)
    .then(({data}) => data)
};
export default post;
